<?php
class AlphabetSelectPanel extends PageElement
{
	protected $displayLetter;
	
	public function setDisplayLetter($displayLetter)
	{
		$this->displayLetter = $displayLetter;
	}
	
	public function getHTML()
	{
		$html = "<div class=\"".$this->name."Div\"><p><b>Filter alphabetically: </b>\n";
		
		$AlphabetLetter = new Hidden();
		$AlphabetLetter->setName($this->name."Letter");
		$AlphabetLetter->setValue($this->displayLetter);
		$html .= $AlphabetLetter->getHTML();
		
		$html .= "<span class=\"".$this->name."Span\" \n";
		$html .= "id=\"".$this->name."-all\" \n";
		$html .= "onMouseOver=\"OnMouseOverAlphabetLetter('".$this->name."','all');\" \n";
		$html .= "onMouseOut=\"OnMouseOutAlphabetLetter('".$this->name."','all');\" \n";
		$html .= "onclick=\"OnClickAlphabetLetter('".$this->name."','');\" \n";
		$html .= ">show all</span>";
		
		for ($i=0;$i<26;$i++)
		{
			$char = chr($i+97);
			$class = ($char==$this->displayLetter)?$this->name."SpanHover":$this->name."Span";
			$html .= "<span class=\"".$class."\" \n";
			$html .= "id=\"".$this->name."-".$char."\" \n";
			$html .= "onMouseOver=\"OnMouseOverAlphabetLetter('".$this->name."','".$char."');\" \n";
			$html .= "onMouseOut=\"OnMouseOutAlphabetLetter('".$this->name."','".$char."');\" \n";
			$html .= "onclick=\"OnClickAlphabetLetter('".$this->name."','".$char."');\" \n";
			
			$html .= ">".$char."</span>";
		}
		
		$html .= "</p></div>\n";
		
		return $html;
	}
}